<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      b {
        color: red;
      }
    </style>
  </head>
  <body>
    <input type="text" id="one" /> vs <input type="text" id="two" />
    <button id="btn">最大的数是>></button> <b id="sum">?</b>
  </body>
  <script>
    function w() {
      var one = document.getElementById("one");
      var two = document.getElementById("two");
      var btn = document.getElementById("btn");
      var sum = document.getElementById("sum");
      btn.onclick = function () {
        if (one.value == "" || two.value == "") {
          return alert("请输入数字！！！");
        }
        if (one.value * 1 > two.value * 1) {
          sum.innerText = one.value;
        } else {
          sum.innerText = two.value;
        }
      };
    }
    w();
  </script>
</html>
